/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EL;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Tian
 */
@Entity
@Table(name = "FoodOrder")
@NamedQueries(
{
    @NamedQuery(name = "FoodOrders.findAll", query = "SELECT f FROM FoodOrders f")
})
public class FoodOrders implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private String id;
    @Column(name = "orderDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date orderDate;
    @Column(name = "isProcessed")
    private Boolean isProcessed;
    @Column(name = "total")
    private Float total;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "foodOrders")
    private List<OrderDetails> orderDetailsList;
    @JoinColumn(name = "accID", referencedColumnName = "id")
    @ManyToOne
    private Accounts accounts;
    
    public FoodOrders()
    {
    }

    public FoodOrders(String id)
    {
        this.id = id;
    }

    public FoodOrders(String id, Date orderDate, Boolean isProcessed)
    {
        this.id = id;
        this.orderDate = orderDate;
        this.isProcessed = isProcessed;
    }

    public FoodOrders(String id, Date orderDate, Boolean isProcessed, Float total)
    {
        this.id = id;
        this.orderDate = orderDate;
        this.isProcessed = isProcessed;
        this.total = total;
    }

    public String getId()
    {
        return id;
    }

    public Float getTotal()
    {
        return total;
    }

    public void setTotal(Float total)
    {
        this.total = total;
    }

    public void setId(String id)
    {
        this.id = id;
    }

    public Date getOrderDate()
    {
        return orderDate;
    }

    public void setOrderDate(Date orderDate)
    {
        this.orderDate = orderDate;
    }

    public Boolean getIsProcessed()
    {
        return isProcessed;
    }

    public void setIsProcessed(Boolean isProcessed)
    {
        this.isProcessed = isProcessed;
    }

    public List<OrderDetails> getOrderDetailsList()
    {
        return orderDetailsList;
    }

    public void setOrderDetailsList(List<OrderDetails> orderDetailsList)
    {
        this.orderDetailsList = orderDetailsList;
    }

    public Accounts getAccounts()
    {
        return accounts;
    }

    public void setAccounts(Accounts accounts)
    {
        this.accounts = accounts;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FoodOrders))
        {
            return false;
        }
        FoodOrders other = (FoodOrders) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "EL.FoodOrders[id=" + id + "]";
    }

}
